<?php

/**
 * SigmaCMS - Content Management System
 *
 * Copyright (C) 2008 Pavol Biely
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * @package    SigmaCMS
 * @author     Pavol Biely <pavolbiely@gmail.com>
 * @copyright  2008 Pavol Biely
 * @license    http://www.gnu.org/licenses/gpl.txt   GNU General Public License
 * @link       http://pabi3.com/
 * @since      0.1.0
 */

session_name('install');
session_start();
session_regenerate_id();

define('INSTALLATION', true);

$isInstalled = dirname(__FILE__).'/../configuration.php';
if (@$_GET['step'] != 5 && @filesize($isInstalled) != 0) {
	header('Location:index.php?step=5');
}

$cfg = array();

$cfg['languages'] = array(
					'en' => 'English',
					'sk' => 'Slovenčina'
					);

$cfg['database'] = array(
					'mysql'      => 'MySQL 4',
					'mysqli'     => 'MySQL 4.1, MySQL 5',
					'mssql'      => 'Microsoft SQL Server',
					'fbsql'      => 'FrontBase',
					'sqlite'     => 'SQLite',
					'postgresql' => 'PostgreSQL'
					);

/*** File includes *************************************************/
$lang = 'en';
if (isset($_SESSION['language'])) {
	if (array_key_exists($_SESSION['language'], $cfg['languages'])) {
		$lang = $_SESSION['language'];
	}
}
include_once './languages/'.$lang.'.php';
include_once './functions.php';
include_once './post.php';
include_once './skin/header.php';

/*** Show configuration steps **************************************/
$step = 1;
if (isset($_GET['step'])) {
	$step = intval($_GET['step']);
	if ($step < 0 || $step > 5) {
		$step = 1;
	}
}
include_once 'forms/step'.$step.'.php';

include_once './skin/footer.php';
